package com.gitee.swsk33.nacosconfigdemo.api;

import com.gitee.swsk33.nacosconfigdemo.property.OnlineProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController
@RequestMapping("/api/config")
public class TestAPI {

	@Value("${config.test-value}")
	private String testValue;

	@Autowired
	private OnlineProperty onlineProperty;

	@GetMapping("/get-value")
	public String getTestValue() {
		return testValue;
	}

	@GetMapping("/get-object")
	public OnlineProperty getOnlineProperty() {
		return onlineProperty;
	}

}